🌎 rns.kin.earth git 🌍
Commit 8aa2f8613af6bb27a57728eddfe677fa7c70186a
Parents : 4d48a50
Author : Mark Qvist <mark@adepta.io>
Date : 2018-04-25T22:46:05+02:00
File transfer example
Changes
3 files changed, 13 insertions(+), 5 deletions(-)
Diff
diff --git a/Examples/Filetransfer.py b/Examples/Filetransfer.py
index 9fb876b0..d4a7f095 100644
--- a/Examples/Filetransfer.py
+++ b/Examples/Filetransfer.py
@@ -86,8 +86,10 @@ def client_connected(link):
# We pack a list of files for sending in a packet
data = umsgpack.packb(list_files())
+ RNS.log(str(len(data)))
+
# Check the size of the packed data
- if len(data) <= RNS.Resource.SDU:
+ if len(data) <= RNS.Reticulum.LINK_MDU:
# If it fits in one packet, we will just
# send it as a single packet over the link.
list_packet = RNS.Packet(link, data)
diff --git a/RNS/Packet.py b/RNS/Packet.py
index 38321ea7..c9f8e269 100755
--- a/RNS/Packet.py
+++ b/RNS/Packet.py
@@ -39,7 +39,7 @@ class Packet:
# This is used to calculate allowable
# payload sizes
- HEADER_MAXSIZE = 23
+ HEADER_MAXSIZE = RNS.Reticulum.HEADER_MAXSIZE
# TODO: This should be calculated
# more intelligently
diff --git a/RNS/Reticulum.py b/RNS/Reticulum.py
index 3e1b6a77..0eea757b 100755
--- a/RNS/Reticulum.py
+++ b/RNS/Reticulum.py
@@ -1,6 +1,7 @@
from Interfaces import *
import ConfigParser
from vendor.configobj import ConfigObj
+import RNS
import atexit
import struct
import array
@@ -11,9 +12,14 @@ import RNS
#import traceback
class Reticulum:
- MTU = 500
- router = None
- config = None
+ MTU = 500
+ HEADER_MAXSIZE = 23
+
+ PAD_AES_HMAC = 64
+ MDU = MTU - HEADER_MAXSIZE
+ LINK_MDU = MDU - PAD_AES_HMAC
+ router = None
+ config = None
configdir = os.path.expanduser("~")+"/.reticulum"
configpath = ""
Served by rngit 1.5.2 - Generated in 0.04s